﻿//
// Created by gogoqiu on 2021/9/23.
//

#include "MyTagApp.h"
#include "editor/PreferencesFrame.h"
#define APP_TAG "SHOULD BE OVERRIDE!"

//MyApp *myApp;
MyTagApp* MyTagApp::myApp = nullptr;

bool MyTagApp::OnInit()
{
    //Android:
    //PreferenceView:
    //PreferenceScreen
    //EditTextPreference
    //SettingsActivity.java
    //walkPreferenceScreen:
    //android.preference.PreferenceGroup: android.preference.Preference
    //sBindPreferenceSummaryToValueListener::onPreferenceChange
    //preference instanceof EditTextPreference: android.preference.Preference
    //...
    //Container:
    //Storage: Path, "~", /home/gogoqiu/, "administrator"
    //getDefaultSharedPreferences: APP_TAG, app.h
    //
    //SharedPreferences: key
    //建立数据库文件
    //create the preference data engine
    //create the preference helper
    //create the preference frame

    myApp = this;
    this->tag = APP_TAG;
    //mPrefStorage;
    //mPrefStorage = SqlitePreferenceStorage::getDefaultSharedPreferences( APP_TAG );
    //mPreferenceCore = new PreferenceCore( APP_TAG );
    //
    //frame->Show(true);
    //MyPre::getInstance()->init();
    //MyPre::getInstance()->setup(  );
    //MyPre::getInstance()->BuildView( frame );
    //MyPreHelper::getInstance();
    //showPreferencesFrame();
    return true;
}

/*
 * ???
 */
void MyTagApp::showPreferencesFrame(wxWindow *parent) {
    if( mPreferencesFrame == nullptr ){
        //
        mPreferencesFrame = new PreferencesFrame( parent, this );
    }
    mPreferencesFrame->Show(true);
}
